package com.xnfh.home


import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.launcher.ARouter
import com.xnfh.common.constant.ArouterPath
import com.xnfh.common.manager.UserInfoManager
import com.xnfh.framework.base.BaseActivity
import com.xnfh.framework.ext.countDownCoroutines
import com.xnfh.home.databinding.ActivitySplashLayoutBinding
import com.xnfh.home.ui.MainActivity

class SplashActivity : BaseActivity<ActivitySplashLayoutBinding>() {
    override fun getLayoutID(): Int = R.layout.activity_splash_layout

    override fun init(savedInstanceState: Bundle?) {
        //倒计时
        countDownCoroutines(0, lifecycleScope, onTick = {
//            mBind.tvSkip.text = getString(R.string.splash_time, it.plus(1).toString())
        }) {
            if (UserInfoManager.instance.isLogin()) {
                MainActivity.start(this)
            } else {
                ARouter.getInstance().build(ArouterPath.LOGIN.LOGIN_ACTIVITY).navigation()
            }
            finish()
        }
    }

    override fun observe() {

    }

}
